package com.rrd.dw.mr.gzip.kafka;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONArray;
import com.ucredit.babel.common.model.BaseModel;
import com.ucredit.babel.common.model.RecordType;
import com.ucredit.babel.common.model.third.baihang.BaihangSMEIS01CRecord;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper.Context;

import java.io.IOException;
import java.util.Objects;

/**
 * 百行-小微关联方探查
 *
 * @author guoqiang
 */

public class BaihangSMEIS01CRecordParse extends ParseBase {
    private Text val = new Text();
    private Text key = new Text();

    /**
     * 百行-小微关联方探查
     *
     * @param model
     * @throws IOException
     * @throws InterruptedException
     */
    @Override
    public boolean parseJob(Context context, BaseModel<?> model, String successful) throws IOException, InterruptedException {
        BaihangSMEIS01CRecord obj = (BaihangSMEIS01CRecord) model;
        StringBuilder sb = getBaseInfo(obj, successful);
        StringBuilder TxSb = new StringBuilder(500);

        String data = obj.getData();
        JSONObject dataJson = JSON.parseObject(data);
        boolean isHead = dataJson.containsKey("head");
        boolean isResponse = dataJson.containsKey("response");
        //旧数据格式
        if(!isHead && !isResponse) {
            String shareholderInfoStr = dataJson.getString("shareholderInfo");
            if(!Objects.equals(shareholderInfoStr, "-1")) {
                JSONArray shareholderInfo = dataJson.getJSONArray("shareholderInfo");
                for(int i = 0; i < shareholderInfo.size(); i ++) {
                    TxSb.delete(0, TxSb.length());
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    JSONObject dataInfo = shareholderInfo.getJSONObject(i);
                    TxSb.append(dataInfo.getString("name") == null ? "" : dataInfo.getString("name")).append(CRT001);
                    TxSb.append(dataInfo.getString("entName") == null ? "" : dataInfo.getString("entName")).append(CRT001);
                    TxSb.append(dataInfo.getString("regNo") == null ? "" : dataInfo.getString("regNo")).append(CRT001);
                    TxSb.append(dataInfo.getString("entType") == null ? "" : dataInfo.getString("entType")).append(CRT001);
                    TxSb.append(dataInfo.getString("regCap") == null ? "" : dataInfo.getString("regCap")).append(CRT001);
                    TxSb.append(dataInfo.getString("entStatus") == null ? "" : dataInfo.getString("entStatus")).append(CRT001);
                    TxSb.append(dataInfo.getString("regCapCur") == null ? "" : dataInfo.getString("regCapCur")).append(CRT001);
                    TxSb.append(dataInfo.getString("creditCode") == null ? "" : dataInfo.getString("creditCode")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgProvince") == null ? "" : dataInfo.getString("regOrgProvince")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgCity") == null ? "" : dataInfo.getString("regOrgCity")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgCityCode") == null ? "" : dataInfo.getString("regOrgCityCode")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgDistrict") == null ? "" : dataInfo.getString("regOrgDistrict")).append(CRT001);
                    TxSb.append(dataInfo.getString("industryCoCode") == null ? "" : dataInfo.getString("industryCoCode")).append(CRT001);
                    TxSb.append(dataInfo.getString("industryCoName") == null ? "" : dataInfo.getString("industryCoName")).append(CRT001);
                    TxSb.append(dataInfo.getString("esDate") == null ? "" : dataInfo.getString("esDate")).append(CRT001);
                    TxSb.append(dataInfo.getString("subAmount") == null ? "" : dataInfo.getString("subAmount")).append(CRT001);
                    TxSb.append(dataInfo.getString("currency") == null ? "" : dataInfo.getString("currency")).append(CRT001);
                    TxSb.append(dataInfo.getString("conform") == null ? "" : dataInfo.getString("conform")).append(CRT001);
                    TxSb.append(dataInfo.getString("fundedRatio") == null ? "" : dataInfo.getString("fundedRatio")).append(CRT001);
                    TxSb.append(dataInfo.getString("lpName") == null ? "" : dataInfo.getString("lpName")).append(CRT001);
                    TxSb.append(dataInfo.getString("entId") == null ? "" : dataInfo.getString("entId")).append(CRT001);
                    TxSb.append(dataInfo.getString("position") == null ? "" : dataInfo.getString("position")).append(CRT001);
                    TxSb.append(dataInfo.getString("entityType") == null ? "" : dataInfo.getString("entityType")).append(CRT001);
                    TxSb.append("shareholderInfo").append(CRT001);
                    key.set(getKey());
                    val.set((sb.toString() + TxSb).replace("\n", " ").replace("\r", " "));
                    context.write(key, val);
                }
            }

            String legalPersonInfoStr = dataJson.getString("legalPersonInfo");
            if(!Objects.equals(legalPersonInfoStr, "-1")) {
                JSONArray legalPersonInfo = dataJson.getJSONArray("legalPersonInfo");
                for(int i = 0; i < legalPersonInfo.size(); i ++) {
                    TxSb.delete(0, TxSb.length());
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    JSONObject dataInfo = legalPersonInfo.getJSONObject(i);
                    TxSb.append(dataInfo.getString("name") == null ? "" : dataInfo.getString("name")).append(CRT001);
                    TxSb.append(dataInfo.getString("entName") == null ? "" : dataInfo.getString("entName")).append(CRT001);
                    TxSb.append(dataInfo.getString("regNo") == null ? "" : dataInfo.getString("regNo")).append(CRT001);
                    TxSb.append(dataInfo.getString("entType") == null ? "" : dataInfo.getString("entType")).append(CRT001);
                    TxSb.append(dataInfo.getString("regCap") == null ? "" : dataInfo.getString("regCap")).append(CRT001);
                    TxSb.append(dataInfo.getString("entStatus") == null ? "" : dataInfo.getString("entStatus")).append(CRT001);
                    TxSb.append(dataInfo.getString("regCapCur") == null ? "" : dataInfo.getString("regCapCur")).append(CRT001);
                    TxSb.append(dataInfo.getString("creditCode") == null ? "" : dataInfo.getString("creditCode")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgProvince") == null ? "" : dataInfo.getString("regOrgProvince")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgCity") == null ? "" : dataInfo.getString("regOrgCity")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgCityCode") == null ? "" : dataInfo.getString("regOrgCityCode")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgDistrict") == null ? "" : dataInfo.getString("regOrgDistrict")).append(CRT001);
                    TxSb.append(dataInfo.getString("industryCoCode") == null ? "" : dataInfo.getString("industryCoCode")).append(CRT001);
                    TxSb.append(dataInfo.getString("industryCoName") == null ? "" : dataInfo.getString("industryCoName")).append(CRT001);
                    TxSb.append(dataInfo.getString("esDate") == null ? "" : dataInfo.getString("esDate")).append(CRT001);
                    TxSb.append(dataInfo.getString("subAmount") == null ? "" : dataInfo.getString("subAmount")).append(CRT001);
                    TxSb.append(dataInfo.getString("currency") == null ? "" : dataInfo.getString("currency")).append(CRT001);
                    TxSb.append(dataInfo.getString("conform") == null ? "" : dataInfo.getString("conform")).append(CRT001);
                    TxSb.append(dataInfo.getString("fundedRatio") == null ? "" : dataInfo.getString("fundedRatio")).append(CRT001);
                    TxSb.append(dataInfo.getString("lpName") == null ? "" : dataInfo.getString("lpName")).append(CRT001);
                    TxSb.append(dataInfo.getString("entId") == null ? "" : dataInfo.getString("entId")).append(CRT001);
                    TxSb.append(dataInfo.getString("position") == null ? "" : dataInfo.getString("position")).append(CRT001);
                    TxSb.append(dataInfo.getString("entityType") == null ? "" : dataInfo.getString("entityType")).append(CRT001);
                    TxSb.append("legalPersonInfo").append(CRT001);
                    key.set(getKey());
                    val.set((sb.toString() + TxSb).replace("\n", " ").replace("\r", " "));
                    context.write(key, val);

                }
            }

            String execInfoStr = dataJson.getString("execInfo");
            if(!Objects.equals(execInfoStr, "-1")) {
                JSONArray execInfo = dataJson.getJSONArray("execInfo");
                for(int i = 0; i < execInfo.size(); i ++) {
                    TxSb.delete(0, TxSb.length());
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    TxSb.append(CRT001);
                    JSONObject dataInfo = execInfo.getJSONObject(i);
                    TxSb.append(dataInfo.getString("name") == null ? "" : dataInfo.getString("name")).append(CRT001);
                    TxSb.append(dataInfo.getString("entName") == null ? "" : dataInfo.getString("entName")).append(CRT001);
                    TxSb.append(dataInfo.getString("regNo") == null ? "" : dataInfo.getString("regNo")).append(CRT001);
                    TxSb.append(dataInfo.getString("entType") == null ? "" : dataInfo.getString("entType")).append(CRT001);
                    TxSb.append(dataInfo.getString("regCap") == null ? "" : dataInfo.getString("regCap")).append(CRT001);
                    TxSb.append(dataInfo.getString("entStatus") == null ? "" : dataInfo.getString("entStatus")).append(CRT001);
                    TxSb.append(dataInfo.getString("regCapCur") == null ? "" : dataInfo.getString("regCapCur")).append(CRT001);
                    TxSb.append(dataInfo.getString("creditCode") == null ? "" : dataInfo.getString("creditCode")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgProvince") == null ? "" : dataInfo.getString("regOrgProvince")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgCity") == null ? "" : dataInfo.getString("regOrgCity")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgCityCode") == null ? "" : dataInfo.getString("regOrgCityCode")).append(CRT001);
                    TxSb.append(dataInfo.getString("regOrgDistrict") == null ? "" : dataInfo.getString("regOrgDistrict")).append(CRT001);
                    TxSb.append(dataInfo.getString("industryCoCode") == null ? "" : dataInfo.getString("industryCoCode")).append(CRT001);
                    TxSb.append(dataInfo.getString("industryCoName") == null ? "" : dataInfo.getString("industryCoName")).append(CRT001);
                    TxSb.append(dataInfo.getString("esDate") == null ? "" : dataInfo.getString("esDate")).append(CRT001);
                    TxSb.append(dataInfo.getString("subAmount") == null ? "" : dataInfo.getString("subAmount")).append(CRT001);
                    TxSb.append(dataInfo.getString("currency") == null ? "" : dataInfo.getString("currency")).append(CRT001);
                    TxSb.append(dataInfo.getString("conform") == null ? "" : dataInfo.getString("conform")).append(CRT001);
                    TxSb.append(dataInfo.getString("fundedRatio") == null ? "" : dataInfo.getString("fundedRatio")).append(CRT001);
                    TxSb.append(dataInfo.getString("lpName") == null ? "" : dataInfo.getString("lpName")).append(CRT001);
                    TxSb.append(dataInfo.getString("entId") == null ? "" : dataInfo.getString("entId")).append(CRT001);
                    TxSb.append(dataInfo.getString("position") == null ? "" : dataInfo.getString("position")).append(CRT001);
                    TxSb.append(dataInfo.getString("entityType") == null ? "" : dataInfo.getString("entityType")).append(CRT001);
                    TxSb.append("execInfo").append(CRT001);
                    key.set(getKey());
                    val.set((sb.toString() + TxSb).replace("\n", " ").replace("\r", " "));
                    context.write(key, val);
                }
            }
            return true;
        }

        JSONObject head = dataJson.getJSONObject("head");
        JSONObject responseJson = JSON.parseObject(dataJson.getString("response"));
        String requestRefId = head.getString("requestRefId");
        String responseRefId = head.getString("responseRefId");
        String result = head.getString("result");
        String responseCode = head.getString("responseCode");
        String responseMsg = head.getString("responseMsg");
        if(responseJson == null){
            TxSb.delete(0, TxSb.length());
            TxSb.append(requestRefId == null ? "" : requestRefId).append(CRT001);
            TxSb.append(responseRefId == null ? "" : responseRefId).append(CRT001);
            TxSb.append(result == null ? "" : result).append(CRT001);
            TxSb.append(responseCode == null ? "" : responseCode).append(CRT001);
            TxSb.append(responseMsg == null ? "" : responseMsg).append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append(CRT001);
            TxSb.append("responseIsNull").append(CRT001);
            key.set(getKey());
            val.set((sb.toString() + TxSb).replace("\n", " ").replace("\r", " "));
            context.write(key, val);
            return true;
        }

        String shareholderInfoStr = responseJson.getString("shareholderInfo");
        if(!Objects.equals(shareholderInfoStr, "-1")) {
            JSONArray shareholderInfo = responseJson.getJSONArray("shareholderInfo");
            for(int i = 0; i < shareholderInfo.size(); i ++) {
                TxSb.delete(0, TxSb.length());
                TxSb.append(requestRefId == null ? "" : requestRefId).append(CRT001);
                TxSb.append(responseRefId == null ? "" : responseRefId).append(CRT001);
                TxSb.append(result == null ? "" : result).append(CRT001);
                TxSb.append(responseCode == null ? "" : responseCode).append(CRT001);
                TxSb.append(responseMsg == null ? "" : responseMsg).append(CRT001);
                JSONObject dataInfo = shareholderInfo.getJSONObject(i);
                TxSb.append(dataInfo.getString("name") == null ? "" : dataInfo.getString("name")).append(CRT001);
                TxSb.append(dataInfo.getString("entName") == null ? "" : dataInfo.getString("entName")).append(CRT001);
                TxSb.append(dataInfo.getString("regNo") == null ? "" : dataInfo.getString("regNo")).append(CRT001);
                TxSb.append(dataInfo.getString("entType") == null ? "" : dataInfo.getString("entType")).append(CRT001);
                TxSb.append(dataInfo.getString("regCap") == null ? "" : dataInfo.getString("regCap")).append(CRT001);
                TxSb.append(dataInfo.getString("entStatus") == null ? "" : dataInfo.getString("entStatus")).append(CRT001);
                TxSb.append(dataInfo.getString("regCapCur") == null ? "" : dataInfo.getString("regCapCur")).append(CRT001);
                TxSb.append(dataInfo.getString("creditCode") == null ? "" : dataInfo.getString("creditCode")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgProvince") == null ? "" : dataInfo.getString("regOrgProvince")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgCity") == null ? "" : dataInfo.getString("regOrgCity")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgCityCode") == null ? "" : dataInfo.getString("regOrgCityCode")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgDistrict") == null ? "" : dataInfo.getString("regOrgDistrict")).append(CRT001);
                TxSb.append(dataInfo.getString("industryCoCode") == null ? "" : dataInfo.getString("industryCoCode")).append(CRT001);
                TxSb.append(dataInfo.getString("industryCoName") == null ? "" : dataInfo.getString("industryCoName")).append(CRT001);
                TxSb.append(dataInfo.getString("esDate") == null ? "" : dataInfo.getString("esDate")).append(CRT001);
                TxSb.append(dataInfo.getString("subAmount") == null ? "" : dataInfo.getString("subAmount")).append(CRT001);
                TxSb.append(dataInfo.getString("currency") == null ? "" : dataInfo.getString("currency")).append(CRT001);
                TxSb.append(dataInfo.getString("conform") == null ? "" : dataInfo.getString("conform")).append(CRT001);
                TxSb.append(dataInfo.getString("fundedRatio") == null ? "" : dataInfo.getString("fundedRatio")).append(CRT001);
                TxSb.append(dataInfo.getString("lpName") == null ? "" : dataInfo.getString("lpName")).append(CRT001);
                TxSb.append(dataInfo.getString("entId") == null ? "" : dataInfo.getString("entId")).append(CRT001);
                TxSb.append(dataInfo.getString("position") == null ? "" : dataInfo.getString("position")).append(CRT001);
                TxSb.append(dataInfo.getString("entityType") == null ? "" : dataInfo.getString("entityType")).append(CRT001);
                TxSb.append("shareholderInfo").append(CRT001);
                key.set(getKey());
                val.set((sb.toString() + TxSb).replace("\n", " ").replace("\r", " "));
                context.write(key, val);
            }
        }

        String legalPersonInfoStr = responseJson.getString("legalPersonInfo");
        if(!Objects.equals(legalPersonInfoStr, "-1")) {
            JSONArray legalPersonInfo = responseJson.getJSONArray("legalPersonInfo");
            for(int i = 0; i < legalPersonInfo.size(); i ++) {
                TxSb.delete(0, TxSb.length());
                TxSb.append(requestRefId == null ? "" : requestRefId).append(CRT001);
                TxSb.append(responseRefId == null ? "" : responseRefId).append(CRT001);
                TxSb.append(result == null ? "" : result).append(CRT001);
                TxSb.append(responseCode == null ? "" : responseCode).append(CRT001);
                TxSb.append(responseMsg == null ? "" : responseMsg).append(CRT001);
                JSONObject dataInfo = legalPersonInfo.getJSONObject(i);
                TxSb.append(dataInfo.getString("name") == null ? "" : dataInfo.getString("name")).append(CRT001);
                TxSb.append(dataInfo.getString("entName") == null ? "" : dataInfo.getString("entName")).append(CRT001);
                TxSb.append(dataInfo.getString("regNo") == null ? "" : dataInfo.getString("regNo")).append(CRT001);
                TxSb.append(dataInfo.getString("entType") == null ? "" : dataInfo.getString("entType")).append(CRT001);
                TxSb.append(dataInfo.getString("regCap") == null ? "" : dataInfo.getString("regCap")).append(CRT001);
                TxSb.append(dataInfo.getString("entStatus") == null ? "" : dataInfo.getString("entStatus")).append(CRT001);
                TxSb.append(dataInfo.getString("regCapCur") == null ? "" : dataInfo.getString("regCapCur")).append(CRT001);
                TxSb.append(dataInfo.getString("creditCode") == null ? "" : dataInfo.getString("creditCode")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgProvince") == null ? "" : dataInfo.getString("regOrgProvince")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgCity") == null ? "" : dataInfo.getString("regOrgCity")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgCityCode") == null ? "" : dataInfo.getString("regOrgCityCode")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgDistrict") == null ? "" : dataInfo.getString("regOrgDistrict")).append(CRT001);
                TxSb.append(dataInfo.getString("industryCoCode") == null ? "" : dataInfo.getString("industryCoCode")).append(CRT001);
                TxSb.append(dataInfo.getString("industryCoName") == null ? "" : dataInfo.getString("industryCoName")).append(CRT001);
                TxSb.append(dataInfo.getString("esDate") == null ? "" : dataInfo.getString("esDate")).append(CRT001);
                TxSb.append(dataInfo.getString("subAmount") == null ? "" : dataInfo.getString("subAmount")).append(CRT001);
                TxSb.append(dataInfo.getString("currency") == null ? "" : dataInfo.getString("currency")).append(CRT001);
                TxSb.append(dataInfo.getString("conform") == null ? "" : dataInfo.getString("conform")).append(CRT001);
                TxSb.append(dataInfo.getString("fundedRatio") == null ? "" : dataInfo.getString("fundedRatio")).append(CRT001);
                TxSb.append(dataInfo.getString("lpName") == null ? "" : dataInfo.getString("lpName")).append(CRT001);
                TxSb.append(dataInfo.getString("entId") == null ? "" : dataInfo.getString("entId")).append(CRT001);
                TxSb.append(dataInfo.getString("position") == null ? "" : dataInfo.getString("position")).append(CRT001);
                TxSb.append(dataInfo.getString("entityType") == null ? "" : dataInfo.getString("entityType")).append(CRT001);
                TxSb.append("legalPersonInfo").append(CRT001);
                key.set(getKey());
                val.set((sb.toString() + TxSb).replace("\n", " ").replace("\r", " "));
                context.write(key, val);

            }
        }

        String execInfoStr = responseJson.getString("execInfo");
        if(!Objects.equals(execInfoStr, "-1")) {
            JSONArray execInfo = responseJson.getJSONArray("execInfo");
            for(int i = 0; i < execInfo.size(); i ++) {
                TxSb.delete(0, TxSb.length());
                TxSb.append(requestRefId == null ? "" : requestRefId).append(CRT001);
                TxSb.append(responseRefId == null ? "" : responseRefId).append(CRT001);
                TxSb.append(result == null ? "" : result).append(CRT001);
                TxSb.append(responseCode == null ? "" : responseCode).append(CRT001);
                TxSb.append(responseMsg == null ? "" : responseMsg).append(CRT001);
                JSONObject dataInfo = execInfo.getJSONObject(i);
                TxSb.append(dataInfo.getString("name") == null ? "" : dataInfo.getString("name")).append(CRT001);
                TxSb.append(dataInfo.getString("entName") == null ? "" : dataInfo.getString("entName")).append(CRT001);
                TxSb.append(dataInfo.getString("regNo") == null ? "" : dataInfo.getString("regNo")).append(CRT001);
                TxSb.append(dataInfo.getString("entType") == null ? "" : dataInfo.getString("entType")).append(CRT001);
                TxSb.append(dataInfo.getString("regCap") == null ? "" : dataInfo.getString("regCap")).append(CRT001);
                TxSb.append(dataInfo.getString("entStatus") == null ? "" : dataInfo.getString("entStatus")).append(CRT001);
                TxSb.append(dataInfo.getString("regCapCur") == null ? "" : dataInfo.getString("regCapCur")).append(CRT001);
                TxSb.append(dataInfo.getString("creditCode") == null ? "" : dataInfo.getString("creditCode")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgProvince") == null ? "" : dataInfo.getString("regOrgProvince")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgCity") == null ? "" : dataInfo.getString("regOrgCity")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgCityCode") == null ? "" : dataInfo.getString("regOrgCityCode")).append(CRT001);
                TxSb.append(dataInfo.getString("regOrgDistrict") == null ? "" : dataInfo.getString("regOrgDistrict")).append(CRT001);
                TxSb.append(dataInfo.getString("industryCoCode") == null ? "" : dataInfo.getString("industryCoCode")).append(CRT001);
                TxSb.append(dataInfo.getString("industryCoName") == null ? "" : dataInfo.getString("industryCoName")).append(CRT001);
                TxSb.append(dataInfo.getString("esDate") == null ? "" : dataInfo.getString("esDate")).append(CRT001);
                TxSb.append(dataInfo.getString("subAmount") == null ? "" : dataInfo.getString("subAmount")).append(CRT001);
                TxSb.append(dataInfo.getString("currency") == null ? "" : dataInfo.getString("currency")).append(CRT001);
                TxSb.append(dataInfo.getString("conform") == null ? "" : dataInfo.getString("conform")).append(CRT001);
                TxSb.append(dataInfo.getString("fundedRatio") == null ? "" : dataInfo.getString("fundedRatio")).append(CRT001);
                TxSb.append(dataInfo.getString("lpName") == null ? "" : dataInfo.getString("lpName")).append(CRT001);
                TxSb.append(dataInfo.getString("entId") == null ? "" : dataInfo.getString("entId")).append(CRT001);
                TxSb.append(dataInfo.getString("position") == null ? "" : dataInfo.getString("position")).append(CRT001);
                TxSb.append(dataInfo.getString("entityType") == null ? "" : dataInfo.getString("entityType")).append(CRT001);
                TxSb.append("execInfo").append(CRT001);
                key.set(getKey());
                val.set((sb.toString() + TxSb).replace("\n", " ").replace("\r", " "));
                context.write(key, val);
            }
        }
        return true;
    }

    @Override
    public String getTableName() {
        return "kafka_babel_baihang_smeis01c_record_inc";
    }

    @Override
    public String getType() {
        return RecordType.BAIHANG_SMEIS01C_RECORD.toString();
    }

    @Override
    public String getComment() {
        return "百行-小微关联方探查";
    }
}
